<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<html>
<head>
    <title>XXX公司人力资源系统后台</title>
</head>
<body>
<div class="hrms_container">
    <!-- 导航条 -->
    <%@ include file="./commom/head.jsp"%>
    <!-- 中间部分（包括左边栏和员工/部门表单显示部分） -->
    <div class="hrms_body" style="position:relative; top:-15px;">
        <!-- 左侧栏 -->
        <%@ include file="./commom/leftsidebar.jsp"%>
        <!-- 中间轮播图内容 -->
        <div class="hrms_main_ad col-sm-10">
            <div class="panel panel-success">
                <div class="panel-heading">
                    <h3 style="text-align: center;">欢迎进入XXX公司人力资源管理系统！</h3>
                </div>
                <div class="panel-body" style="position:relative; top:-15px;  background:azure;">
                   <div   style="width: 95%;height: 580px; margin: 0 auto; margin-top: 45px">
                       <div class="panel admin-panel">
                           <table class="table table-hover text-center" id="table">
                               <tr >
                                   <td><h3>角色</h3></td>
                                   <td ><h3>权限</h3></td>
                                   <td><h3>操作</h3></td>
                               </tr>
                               <c:forEach   items= "${listMenu}" var= 'list'>
                               <tr>
                                   <td>${list.roleName}</td>
                                   <td>
                                       <c:forEach items="${list.menus}" var="mt">
                                       <span>${mt.getMenuName()}</span>
                                       </c:forEach>
                                   </td>
                                   <td>
                                   <button type="button" class="asasd" name="${list.roleId}" data-toggle="modal" data-target="#exampleModal2">添加权限</button>
                               </tr>
                               </c:forEach>
                           </table>
                       </div>
                   </div>
                </div><!-- /.panel-body -->
            </div><!-- /.panel -->
        </div><!-- /.hrms_main_ad -->
    </div><!-- /.hrms_body -->
    <!-- 尾部 -->
    <%@ include file="./commom/foot.jsp"%>
</div><!-- /.hrms_container -->
<!--Model-->
<div class="modal fade" id="exampleModal2" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <h4 class="modal-title" id="exampleModalLabel">选择权限</h4>
            </div>
            <form action="<%=request.getContextPath()%>/insert/RoleMenu"  method="post">
                <div class="modal-body">
                    <input type="text" name="roleId" id="beipinglun" hidden="hidden" value=/>
                    <div>
                        <select name="menuId" style="width: 186px;height:27px;margin-left:100px;">
                            <option value="" selected>选择权限</option>
                            <c:forEach items="${menu}" var="map">
                                <option value="${map.menuId}">${map.menuName}</option>
                            </c:forEach>
                        </select>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                    <button type="submit" class="btn btn-primary">提交</button>
                </div>
            </form>

        </div>
    </div>
</div>
</body>
<script>
    jQuery(document).ready(function () {

        jQuery(".panel-body").on("click",".asasd",function () {
            var userid=jQuery(this).prop("name")
            jQuery("#beipinglun").prop("value",userid)
        })
    })
</script>
</html>
